<!--

Saherace - Rent a Car

This page is the start page of the website. 
It shows the form for searching available cars
in a specific period of time. 	

-->


<!-- Include the soap client connection and the header area of the website -->
<?php include('includes/header.php'); ?>
	
<!-- The form where the user can insert the data -->
<form action="cars.php" method="POST">
	<ul data-role="listview" data-inset="true">
		<!-- Insert fields for start date and start station -->
		<li data-role="list-divider">Anmietung</li>
		<li>
			<table>
				<tr>
					<td width="100">Zeit:</td>
					<td><input id="start_date" name="start_date" type="datetime" required value="<?php if(isset($_SESSION['start_date'])) echo $_SESSION['start_date']; ?>" /></td>
				</tr>
				<tr>
					<td>Station:</td>
					<td>
						<select name="start_station" id="start_station" data-mini="true">
						<?php
							//show all available stations from webservice
							$getStations = $client->getStations();
							for($i = 0; $i < sizeof($getStations->return); $i++){
								echo '<option value='. $getStations->return[$i]->station_id .'>' . $getStations->return[$i]->city . '</option>';
							}
						?>
						</select>
					</td>
				</tr>					
			</table>
		</li>
	</ul>

	<ul data-role="listview" data-inset="true">
		<!-- Insert fields for end date and end station -->
		<li data-role="list-divider">Rückgabe</li>
		<li>
			<table>
				<tr>
					<td width="100">Zeit:</td>
					<td><input id="end_date" name="end_date" type="datetime" required value="<?php if(isset($_SESSION['end_date'])) echo $_SESSION['end_date']; ?>" /></td>
				</tr>
				<tr>
					<td>Station:</td>
					<td>
						<select name="end_station" id="end_station" data-mini="true">
						<?php
							//show all available stations from webservice
							$getStations = $client->getStations();
							for($i = 0; $i < sizeof($getStations->return); $i++){
								echo '<option value='. $getStations->return[$i]->station_id .'>' . $getStations->return[$i]->city . '</option>';
							}
						?>
						</select>
					</td>
				</tr>					
			</table>
		</li>
	</ul>
	<input type="submit" value="Weiter" data-icon="arrow-r" data-iconpos="right" />
</form>	
	
<!-- Include the footer area of the website -->
<?php include('includes/footer.php'); ?>